//
//  M_ZoneCell.swift
//  letuofu
//
//  Created by WH-JS on 2019/12/12.
//  Copyright © 2019 WH-JS. All rights reserved.
//

import UIKit

class M_ZoneCell: QuickTableCellWithInit<ZoneCodeModel> {
    let nameLabel = UILabel()
    
    override class func heightOf(_ data:ZoneCodeModel)->CGFloat{
        return 30
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
        if selected {
            nameLabel.textColor = .xFC4C02
        }
        else {
            nameLabel.textColor = .x666666
        }
    }
    
    override func initCell(container: UIView) {
        container.drawLabel(label: nameLabel, text: "", fontSize: 12, fontWeight: .medium, textColor: .x666666){ (make) in
            make.center.equalToSuperview()
        }
        
        //画横线
        let line = container.drawView { (make) in
            make.left.equalToSuperview().offset(17)
            make.right.equalToSuperview().offset(-17)
            make.bottom.equalToSuperview()
            make.height.equalTo(0.5)
        }
        line.backgroundColor = .xF2F2F2
    }
    
    override func fillCell(_ data: ZoneCodeModel, at index: Int) {
        if data.code == "105002" {
            nameLabel.text = "京东配送"
        }
        else {
            nameLabel.text = "自营"
        }
    }
}
